<?php


namespace app\controllers;


use app\models\EntryForm;
use app\models\Person;
use Yii;
use app\models\Post;
use yii\web\Controller;
use yii\web\NotFoundHttpException;

class IndexController extends Controller
{

    public function actionIndex($msg="成功了")
    {
        $countries = Person::find()->orderBy('name')->all();
        var_dump($countries);
        return $this->render("index",["msg"=>$msg]);

    }

    public function actionEntry()
    {
        $model = new EntryForm();
        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            // 验证 $model 收到的数据

            // 做些有意义的事 ...

            return $this->render('entry-confirm', ['model' => $model]);
        } else {
            // 无论是初始化显示还是数据验证错误
            return $this->render('entry', ['model' => $model]);
        }
    }

}